package com.knowledge.business.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.knowledge.business.domain.FxDTO;
import com.knowledge.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.knowledge.business.mapper.SysMessageMapper;
import com.knowledge.business.domain.SysMessage;
import com.knowledge.business.domain.HotMessageDTO;
import com.knowledge.business.service.ISysMessageService;

/**
 * 人与AI对话消息Service业务层处理
 *
 * @author zhaoyk
 * @date 2025-09-26
 */
@Service
public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMessage> implements ISysMessageService {
    @Autowired
    private SysMessageMapper sysMessageMapper;

    /**
     * 查询人与AI对话消息
     *
     * @param messageId 人与AI对话消息主键
     * @return 人与AI对话消息
     */
    @Override
    public SysMessage selectSysMessageByMessageId(Long messageId) {
        return sysMessageMapper.selectSysMessageByMessageId(messageId);
    }

    /**
     * 查询人与AI对话消息列表
     *
     * @param sysMessage 人与AI对话消息
     * @return 人与AI对话消息
     */
    @Override
    public List<SysMessage> selectSysMessageList(SysMessage sysMessage) {
        return sysMessageMapper.selectSysMessageList(sysMessage);
    }

    /**
     * 新增人与AI对话消息
     *
     * @param sysMessage 人与AI对话消息
     * @return 结果
     */
    @Override
    public int insertSysMessage(SysMessage sysMessage) {
        sysMessage.setCreateTime(DateUtils.getNowDate());
        return sysMessageMapper.insertSysMessage(sysMessage);
    }

    /**
     * 修改人与AI对话消息
     *
     * @param sysMessage 人与AI对话消息
     * @return 结果
     */
    @Override
    public int updateSysMessage(SysMessage sysMessage) {
        return sysMessageMapper.updateSysMessage(sysMessage);
    }

    /**
     * 批量删除人与AI对话消息
     *
     * @param messageIds 需要删除的人与AI对话消息主键
     * @return 结果
     */
    @Override
    public int deleteSysMessageByMessageIds(Long[] messageIds) {
        return sysMessageMapper.deleteSysMessageByMessageIds(messageIds);
    }

    /**
     * 删除人与AI对话消息信息
     *
     * @param messageId 人与AI对话消息主键
     * @return 结果
     */
    @Override
    public int deleteSysMessageByMessageId(Long messageId) {
        return sysMessageMapper.deleteSysMessageByMessageId(messageId);
    }

    @Override
    public List<SysMessage> selectMessagesHot(FxDTO dto) {
        List<SysMessage> sysMessages = sysMessageMapper.selectMessagesHot(dto);
        return sysMessages;
    }

    @Override
    public List<SysMessage> selectMessagesWithTimeByDays(FxDTO dto) {
        List<SysMessage> sysMessages = sysMessageMapper.selectMessagesWithTimeByDays(dto);
        return sysMessages;
    }


}
